//
//  SecondViewController.m
//  5.12知识点UI08_界面通信
//
//  Created by dingcong on 16/5/12.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "SecondViewController.h"

@interface SecondViewController ()
@property (nonatomic, retain)UITextField *text1;
@end

@implementation SecondViewController



- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
//    [creatTextFie]

    self.view.backgroundColor = [UIColor whiteColor];
    [self creatTextField];
    self.title = @"第二页";
    [self creatButton];
    
}

- (void)creatTextField
{
    self.text1 = [[UITextField alloc]initWithFrame:CGRectMake(120, 120, 200, 40)];
        
    self.text1.backgroundColor = [UIColor cyanColor];
    [self.view addSubview:_text1];
    
    NSLog(@"%s", __FUNCTION__);
    self.text1.text = self.contentOfLable;
}
//创建button
- (void)creatButton
{
    UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
    button.frame = CGRectMake(180, 200, 70, 40);
    button.backgroundColor = [UIColor blackColor];
    [self.view addSubview:button];
    [button setTitle:@"上一页" forState:UIControlStateNormal];
    [button addTarget:self action:@selector(handleButtonAction:) forControlEvents:UIControlEventTouchUpInside];
    
    
    
}
#pragma mark - 第三步
//执行协议方法
- (void)handleButtonAction:(UIButton *)button
{
    [self.secondDelegate changeValue:self.text1.text];
    
    [self.navigationController popViewControllerAnimated:YES];
    
    
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
